import req from "../utils/http"
//登录
export function getLogin(username,rememberMe,password){
    const params = new URLSearchParams();
    params.append("username",username);
    params.append("rememberMe",rememberMe);
    params.append("password",password);
    return req.post(`/api/login`,params)
}
//注册
export function getRegister(loginName,code,phonenumber,password,userName){
    // const url=`/api/registry`
    const params = new URLSearchParams();
    params.append("loginName",loginName);
    params.append("code",code);
    params.append("phonenumber",phonenumber);
    params.append("password",password);
    params.append("userName",userName);
    // return request.post(url,params)
    return req.post(`/api/registry` , params)

}
//短信验证
export function getSMSverification(mobile){
    return req.get(`/api/short-message/vcode/${mobile}`)
}
//查看个人信息
export function getPersoninfo(){
    return req.get(`/api/login-user/info`)
}
//忘记密码
export function getForgetpassword(loginName,code,phonenumber,password){
    const params = new URLSearchParams();
    params.append("loginName",loginName);
    params.append("code",code);
    params.append("phonenumber",phonenumber);
    params.append("password",password);
    return req.get(`/api/password/forget`,params)
}
//修改个人信息
export function getChangeinfo(userName,email,phonenumber,remark){
    const params = new URLSearchParams();
    params.append("userName",userName);
    params.append("email",email);
    params.append("remark",remark);
    params.append("phonenumber",phonenumber);
    return req.get(`/api/system/user/profile/update`)
}
//修改头像
export function getChangephoto(file){
    const params = new FormData();
    params.append("avatarfile",file);
    return req.get(`/api/system/user/profile/update/avatar/nos`,params)
}

//上传图片
export function getUploadpictures(){
    return req.get(`/api/nos/upload/image`)
}
//退出登录
export function getLogout(){
    return req.get(`/api/logout`)
}